package vm.machine;

public class PopInstruction extends   AbstractInstruction{

    private String register;

    public PopInstruction(Machine machine, String register){
        super(machine);
        this.register = register;
    }
    @Override
    public void doAction() {
        Integer value = machine.getStack().pop();
        Register reg = machine.getRegister(register);
        if(register != null){
            reg.setValue(value);
        }
    }
    @Override
    public String toString() {
        return "执行Pop指令";
    }
}
